import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.swing.Box.Filler;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

public class TestTable {

	Table t = null;
	Deck d;
	@Before
	public void setUp() throws Exception {
		t = new Table();
	}

	@Test
	public void pokerTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 10);
		Card b = new Card("diamond", 11);
		Card c = new Card("diamond", 12);
		Card d = new Card("diamond", 13);
		Card e = new Card("diamond", 14);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(1, test[0]);
	}

	@Test
	public void colorTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("diamond", 4);
		Card c = new Card("diamond", 6);
		Card d = new Card("diamond", 8);
		Card e = new Card("diamond", 10);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(4, test[0]);
	}

	@Test
	public void fourOfAKindTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 8);
		Card b = new Card("club", 8);
		Card c = new Card("spade", 8);
		Card d = new Card("heart", 8);
		Card e = new Card("diamond", 10);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(2, test[0]);
	}

	@Test
	public void fullHouseTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 3);
		Card b = new Card("club", 2);
		Card c = new Card("heart", 2);
		Card d = new Card("diamond", 3);
		Card e = new Card("heart", 3);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(3, test[0]);
	}

	@Test
	public void straightrTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("club", 3);
		Card c = new Card("diamond", 4);
		Card d = new Card("diamond", 5);
		Card e = new Card("diamond", 6);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(5, test[0]);
	}

	@Test
	public void threeOfAKindTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("club", 2);
		Card c = new Card("heart", 2);
		Card d = new Card("diamond", 8);
		Card e = new Card("diamond", 10);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(6, test[0]);
	}

	@Test
	public void twoPairsTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("club", 2);
		Card c = new Card("diamond", 6);
		Card d = new Card("club", 6);
		Card e = new Card("diamond", 10);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(7, test[0]);
	}

	@Test
	public void pairTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("club", 2);
		Card c = new Card("diamond", 6);
		Card d = new Card("diamond", 8);
		Card e = new Card("diamond", 10);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(8, test[0]);
	}

	@Test
	public void highCardTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("club", 4);
		Card c = new Card("heart", 6);
		Card d = new Card("spade", 8);
		Card e = new Card("diamond", 10);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		int test[] = new int[3];
		test = t.pokerHands(testList);
		assertEquals(9, test[0]);
	}
	
	@Test
	public void wydajnosc(){
		for(int i =0; i < 1000000; i++)
			d = new Deck();
	}

}
